﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TrainingManagerSystem.WebUI.TrainingManagerSystemService;
using TrainingManagerSystem.WebUI.Models;
using CourseInstructor = TrainingManagerSystem.WebUI.TrainingManagerSystemService.CourseInstructor;
using ArticleSV = TrainingManagerSystem.WebUI.TrainingManagerSystemService.Article;

namespace TrainingManagerSystem.WebUI.Controllers
{
    public class HomeController : Controller
    {
        private readonly TrainingManagerSystemModelClient _service = new TrainingManagerSystemModelClient();
        private string AccountId = Environment.UserName;
        //
        // GET: /Home/

        private CourseInstructorManager _courseInstructorManager;

        public ActionResult Index()
        {
            return View();
        }

        public PartialViewResult CourseInstructor()
        {
            if (_service.CheckRole("QuyenNTH", PermissionViewConst.Course))
            {
                _courseInstructorManager = new CourseInstructorManager();
                List<CourseInstructor> data = _courseInstructorManager.FetchAllByInstructorId("00000007");
                return PartialView("_PersonTrainingContribution", data);
            }
            return PartialView("Empty");
        }

        public PartialViewResult GetArticle() {
            int totalRecords=0;
            var host = new TrainingManagerSystemService.TrainingManagerSystemModelClient();
            var result = host.GetArticlePaging(5, 1, out totalRecords);
            return PartialView("_Article", result);
        }

        //public JsonResult {
        //}
    }
}
